package DEEPERsource.DEEPERsource.source.machinelearning.utils;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class EvaluationEntry{
	public String sentenceId;
	public Set<String> agents = new HashSet<String>();
	public Set<String> targets = new HashSet<String>();
	public List<String[]> interactions = new ArrayList<String[]>();
	
	public String toString(){
		if(interactions.size()==0){
			return emptyString();
		}
		String result = "ID\t"+sentenceId.trim()+"\n";
		result += "agents";
		for(String agent : agents){
			result += "\tagent('"+agent+"')";
		}
		result += "\n";
		
		result += "targets";
		for(String target : targets){
			result += "\ttarget('"+target+"')";
		}
		result += "\n";
		
		result += "genic_interactions";
		for(String[] interaction : interactions){
			result += "\tgenic_interaction('"+interaction[0]+"','"+interaction[1]+"')";
		}
		result += "\n";
		
		return result;			
	}
	
	public String toString2(){
		String result = "ID\t"+sentenceId.trim()+"\n";
		result += "agents";
		for(String agent : agents){
			result += "\tagent('"+agent+"')";
		}
		for(String agent : targets){
			result += "\tagent('"+agent+"')";
		}
		result += "\n";
		
		result += "targets";
		for(String target : targets){
			result += "\ttarget('"+target+"')";
		}
		for(String target : agents){
			result += "\ttarget('"+target+"')";
		}
		result += "\n";
		
		result += "genic_interactions";
		for(String[] interaction : interactions){
			result += "\tgenic_interaction('"+interaction[0]+"','"+interaction[1]+"')";
			result += "\tgenic_interaction('"+interaction[1]+"','"+interaction[0]+"')";
		}
		result += "\n";
		
		return result;			
	}
	
	public String emptyString(){
		String result = "ID\t"+sentenceId.trim()+"\n";
		result += "agents\ntargets\ngenic_interactions\n";
		return result;
	}
	
	public int getNumOfInteractions(){
		return interactions.size();
	}
}
